package com.yoki.cloud.common.core.vo;

import com.yoki.cloud.common.model.exception.Shift;
import com.yoki.cloud.common.model.exception.enums.BasicRestStatus;
import lombok.Data;

/**
 * 智慧社区系统用户权限
 */
@Data
public class CommunityUser {

    // 是否社区用户
    private boolean community;
    // 是否志愿者
    private boolean volunteer;
    //是否党员
    private boolean partyMember;
    // 是否城管
    private boolean urbanManagement;
    // 是否商家
    private boolean seller;

    public void verifyCommunity(){
        if(!community){
            Shift.fatal(BasicRestStatus.UNAUTHORIZED_ERROR);
        }
    }
    public void verifyVolunteer(){
        if(!volunteer){
            Shift.fatal(BasicRestStatus.UNAUTHORIZED_ERROR);
        }
    }
    public void verifyPartyMember(){
        if(!partyMember){
            Shift.fatal(BasicRestStatus.UNAUTHORIZED_ERROR);
        }
    }
    public void verifyUrbanManagement(){
        if(!urbanManagement){
            Shift.fatal(BasicRestStatus.UNAUTHORIZED_ERROR);
        }
    }
    public void verifySeller(){
        if(!seller){
            Shift.fatal(BasicRestStatus.UNAUTHORIZED_ERROR);
        }
    }
}
